import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import render from '@dfeidao/atom-web/render/render';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
import p001 from './p001';
import p002 from './p002';
import p003 from './p003';
export default async function a001(fd: IFeidaoAiBrowserComponent) {
	// todo
	const xiang = fd.data.node.querySelector<HTMLDivElement>('[data-id="Xiang"]');
	set_node_cls(xiang,'display-n',false);
	const res = await nodejs<{dt: Array<{}>;c: number}>('risk-control/zj-000005/s001', {pn:1 });
	const dtdata = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-presentation="p001"]');
	const dtNodata = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-presentation="p002"]');
	const dtpn = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-presentation="p003"]');
	if (res.dt.length > 0 ) {
		render(fd,res.dt,p001,'p001','inner');
		render(fd,res.c,p003,'p003','inner');
		dtdata.style.display = 'block';
		dtNodata.style.display = 'none';
		dtpn.style.display = 'block';
	}
	if (res.dt.length <= 0) {
		render(fd,"",p002,'p002','inner');
		dtdata.style.display = 'none';
		dtNodata.style.display = 'block';
		dtpn.style.display = 'none';
	}
}
